package com.example.dto;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import org.springframework.security.oauth2.server.authorization.settings.OAuth2TokenFormat;

import java.io.IOException;

public class OAuth2TokenFormatDeserializer extends JsonDeserializer<OAuth2TokenFormat> {

    @Override
    public OAuth2TokenFormat deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
        String value = p.getText(); // 获取 JSON 中的值
        return new OAuth2TokenFormat(value); // 转换为 OAuth2TokenFormat 对象
    }
}